Skip to content

Fix #8404: Use both scrutinee type and given type in pattern ascriptions #8413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 2, 2020

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Mar 1, 2020

In a pattern ascription x: T, type x to have the intersection of
the given type T and the scrutinee type. This matches scalac's behavior.
It now makes i5418.scala compile. The type intersection was enough to make
that one compile, it did not need unsound covariant GADT matching (which was
what I claimed before in the issue).

Fixes #3208

…riptions

In a pattern ascription `x: T` type `x` to have the intersection of
the given type `T` and the scrutinee type. This matches scalac's behavior.
It now makes i5418.scala compile. The type intersection was enough to make
that one compile, it did not need unsound covariant GADT matching (which was
what I claimed before in the issue).
@allanrenucci
Copy link
Contributor

I believe this fixes #3208 as well.

@smarter smarter linked an issue Mar 1, 2020 that may be closed by this pull request
@odersky
Copy link
Contributor Author

odersky commented Mar 1, 2020

@allanrenucci

I believe this fixes #3208 as well.

yes, indeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

typed patterns get more precise types in scalac than dotty
3 participants